create_agentic_context
¶
create_agentic_context(
name: AgenticContextName,
context_type: AgenticContextType,
target_file_path: AgenticContextTargetFilePath,
*,
config_overrides: Optional[WorkSpacesClientConfig] = None,
client_token: Optional[IdempotencyToken] = None,
description: Optional[AgenticContextDescription] = None,
context_body: Optional[AgenticContextBody] = None,
tags: Optional[TagList] = None,
) -> CreateAgenticContextResult
Creates an agentic context, which is Markdown content that the service writes to a file on the WorkSpace for the agent to use. The name must be unique among the contexts in your account. If it isn't, the operation returns ConflictException, and its ResourceId identifies the existing context. If the tags would exceed the limit of 50 tags per resource, the operation returns ServiceQuotaExceededException.
Parameters:
-
client_token(Optional[IdempotencyToken], default:None) –A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request with the same parameters, the service returns the result of that request and doesn't create another context.
If you reuse the token with different parameters, the operation returns
ValidationException. If you deleted the context created with this token, the operation returnsResourceNotFoundException. -
name(AgenticContextName) –The name of the context.
-
description(Optional[AgenticContextDescription], default:None) –The description of the context.
-
context_type(AgenticContextType) –The type of the context. Valid values:
-
STEERING– Guidance that shapes how the agent behaves. -
SKILL– A reusable capability that the agent can use. -
WORKFLOW– A multi-step procedure that the agent follows.
-
-
target_file_path(AgenticContextTargetFilePath) –The name of the Markdown file that the context is written to on the WorkSpace, for example
code-review.md. This is a file name, not a path. It can contain letters, digits, periods (.), underscores (_), and hyphens (-), can be 1–255 characters long, and can't be.or... -
context_body(Optional[AgenticContextBody], default:None) –The Markdown content of the context, up to 1 MiB of UTF-8 text. Currently, you must specify this field.
-
tags(Optional[TagList], default:None) –The tags to add to the context. Each tag key can appear only once.
Raises:
-
AccessDeniedException–The user is not authorized to access a resource.
-
ConflictException–The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.
-
ResourceNotFoundException–The resource could not be found.
-
ServiceQuotaExceededException–The request would exceed a service quota. Request a quota increase or reduce the number of resources in your request.
-
ThrottlingException–The request was throttled. Retry the request with exponential backoff.
-
ValidationException–Your request failed validation. Check the error message for the parameter that isn't valid.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Example – Creating a steering context The following example creates a steering context that agents read from the file coding-standards.md.
>>> client.create_agentic_context(client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='coding-standards', description='Team coding standards for agents.', context_type='STEERING', target_file_path='coding-standards.md', context_body='# Coding standards\n\nWrite unit tests for every change.', tags=[{'Key': 'team', 'Value': 'platform'}])
Source code in docs_src/capo_workspaces/_services/work_spaces.py
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 | |