create_agentic_context
async
¶
create_agentic_context(
name: AgenticContextName,
context_type: AgenticContextType,
target_file_path: AgenticContextTargetFilePath,
*,
config_overrides: Optional[AsyncWorkSpacesClientConfig] = 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.
>>> await 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/async_work_spaces.py
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 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 | |