Skip to content

Toshok's typescript port #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Toshok's typescript port #30

wants to merge 32 commits into from

Conversation

Domiii
Copy link
Collaborator

@Domiii Domiii commented Aug 8, 2024

No description provided.

import { BaseAgent } from "./base_agent";

export abstract class Agent extends BaseAgent {
model: ReturnType<typeof createReactAgent>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We always use 2 space-indent for everything where possible.
(I'm not sure why I was not able to get VSCode to use 2 space-indent for python, hence we ended up with 4 spaces there)


const schema = z.object({
agent_name: z.string().describe("Name of the agent to invoke"),
prompt: z.string().describe("Prompt to run with the agent"),
});


// a hack to clear the async local storage langchain uses to send events to the correct stream.
Copy link
Collaborator Author

@Domiii Domiii Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Let's move this to a separate file?
Also, generally, any code that executes on import is likely coming back to haunt you at some point in time. Putting it in an init function and requiring an explicit goal might be a better idea.

Domiii and others added 9 commits August 9, 2024 00:40
* Fix passing of `CodeContext` among agents and tools.
* Add `boxen`.
* Fix `indexFiles` to only do its job once.
* Fix `gitignore` handling in subdirectories in `getAllSrcFiles`.
* Add `runAgentPrompt`
switch to a dynamic import so we can maybe register some instrumentation plugins before importing the code we want to instrument

save the service name as well, clean up some snake_case, and add the msn fields to all agent spans

a lot more instrumentation fixes
Copy link

socket-security bot commented Aug 13, 2024

export function instrument<T extends (...args: any) => any>(
type ValueOfPromise<T> = T extends Promise<infer U> ? U : never;

function isPromise<T>(value: unknown): value is Promise<ValueOfPromise<T>> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, people use isThenable instead of isPromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants